using System;
using System.Data.Linq;

namespace RomanJendrusz.Amazon.ETL.Domain
{
    public class SellerOffer
    {
        private string bookAsin;
        private string sellerId;
        private EntityRef<Seller> seller;
        private EntityRef<Book> book;
        private DateTime updated;


        public SellerOffer()
        {
            book = new EntityRef<Book>();
            seller = new EntityRef<Seller>();
        }
        public int SellerOfferId { get; set; }
        public string ExchangeId { get; set; }
        public decimal Price { get; set; }
        public Currency Currency { get; set; }
        public int Quantity { get; set; }
        public DateTime StartDate { get; set; }

        public DateTime EndDate { get; set; }
        public string CoditionNote { get; set; }
        public string Condition { get; set; }
        public string Availability { get; set; }
        public bool IsEligibleForSuperSaverShipping { get; set; }
        /// <summary>
        /// Gets or sets the row updated.
        /// </summary>
        /// <value>The row updated.</value>
        public DateTime Updated
        {
            get { return updated; }
        }

        public Seller Seller
        {
            get { return seller.Entity; }
            set
            {
                if (value == null) throw new ArgumentNullException("value");
                seller.Entity = value;
                sellerId = value.SellerId;
            }
        }

        public Book Book
        {
            get { return book.Entity; }
            set
            {
                if (value == null) throw new ArgumentNullException("value");
                book.Entity = value;
                bookAsin = value.Asin;
            }
        }
    }
}